package org.jeecg.modules.education.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.education.entity.Education;
import org.jeecg.modules.education.mapper.EducationMapper;
import org.jeecg.modules.education.service.EducationService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 学历
 *
 * @author liujiamiao
 * @email 2544296058@qq.com
 * @date 2020-10-24 21:33
 */
@Service

public class EducationServiceImpl extends ServiceImpl<EducationMapper,Education> implements EducationService {


    @Override
    public Integer getIdByName(String name) {
        Education education = baseMapper.selectOne(new QueryWrapper<Education>().eq("education_name", name).select("education_id"));
        return education.getEducationId();
    }

    @Override
    public List<Education> sortList() {
        QueryWrapper<Education> wrapper = new QueryWrapper<>();
        wrapper.orderByAsc("sort");
        List<Education> list = this.list(wrapper);
        return list;
    }
}
